package cn.tedu.store.temperatureDetection.controller;

import cn.tedu.store.common.ApiResult;
import cn.tedu.store.temperatureDetection.service.PatientInfoService;
import cn.tedu.store.temperatureDetection.service.RMTJService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 75936
 * @version 1.0
 * @project demo_hesuan
 * @description
 * @date 2022-11-29 10:46:11
 */
@RestController
@RequestMapping("PatientInfo")
public class PatientInfoController {
    @Autowired
    private PatientInfoService patientInfoService;
    @Autowired
    private RMTJService rmtjService;



    @GetMapping("findPatientInfo")
    public ApiResult findPatientInfo(@RequestParam("idEnNo") String idEnNo){
        return ApiResult.ok(patientInfoService.findPatientInfo(idEnNo));
    }

    @GetMapping("findPhone")
    public ApiResult findPhone(@RequestParam("idEnNo")String idEnNo){
        return ApiResult.ok(rmtjService.findZhongYi(idEnNo));
    }

    @GetMapping("loginPatientInfo")
    public ApiResult loginPatientInfo(@RequestParam("userName")String userName,@RequestParam("passWord")String passWord){
        return  ApiResult.ok(patientInfoService.findByUserName(userName, passWord));
    }

    @GetMapping("/findPatientInfoByPhone")
    public ApiResult findPatientInfoByPhone(@RequestParam("phone")String phone){
        return ApiResult.ok(patientInfoService.findPatientInfoByPhone(phone));
    }


}
